package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.EcologyHatchShareIncomeConf;
import com.sc.nft.entity.EcologyHatchShareProfitMethodConf;
import com.sc.nft.entity.ResonanceServiceCenterCoefficientConf;
import com.sc.nft.mapper.ResonanceServiceCenterCoefficientConfMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 共振服务中心系数考核配置表 DAO
 *
 * @Author：LiGen
 * @Package：com.sc.nft.dao
 * @Project：sc_metago
 * @name：ResonanceServiceCenterCoefficientConfDao
 * @Date：2024/7/14 14:23
 * @Filename：ResonanceServiceCenterCoefficientConfDao
 */
@Slf4j
@Repository
public class ResonanceServiceCenterCoefficientConfDao extends ServiceImpl<ResonanceServiceCenterCoefficientConfMapper, ResonanceServiceCenterCoefficientConf> {

    /**
     * 获取熔炼下共振服务中心系数考核配置
     *
     * @param ecologyHatchId
     * @return
     */
    public List<ResonanceServiceCenterCoefficientConf> getListByEcologyHatchId(Long ecologyHatchId) {
        LambdaQueryWrapper<ResonanceServiceCenterCoefficientConf> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(ResonanceServiceCenterCoefficientConf::getEcologyHatchId, ecologyHatchId);
        wrapper.orderByAsc(ResonanceServiceCenterCoefficientConf::getLevel);
        return list(wrapper);
    }

    /**
     * 移除城市服务中心分润考核系数
     *
     * @param ecologyHatchId
     * @return
     */
    public boolean removeByConfId(Long ecologyHatchId) {
        LambdaQueryWrapper<ResonanceServiceCenterCoefficientConf> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(ResonanceServiceCenterCoefficientConf::getEcologyHatchId, ecologyHatchId);
        return remove(wrapper);
    }

}
